﻿using System;

namespace UniRx
{
	// Token: 0x0200022D RID: 557
	public class ScheduledNotifier<T> : IObservable<T>, IProgress<T>
	{
		// Token: 0x06000D0C RID: 3340 RVA: 0x0003F00C File Offset: 0x0003D40C
		public ScheduledNotifier()
		{
			this.scheduler = Scheduler.DefaultSchedulers.ConstantTimeOperations;
		}

		// Token: 0x06000D0D RID: 3341 RVA: 0x0003F02A File Offset: 0x0003D42A
		public ScheduledNotifier(IScheduler scheduler)
		{
			if (scheduler == null)
			{
				throw new ArgumentNullException("scheduler");
			}
			this.scheduler = scheduler;
		}

		// Token: 0x06000D0E RID: 3342 RVA: 0x0003F058 File Offset: 0x0003D458
		public void Report(T value)
		{
			this.scheduler.Schedule(delegate()
			{
				this.trigger.OnNext(value);
			});
		}

		// Token: 0x06000D0F RID: 3343 RVA: 0x0003F094 File Offset: 0x0003D494
		public IDisposable Report(T value, TimeSpan dueTime)
		{
			return this.scheduler.Schedule(dueTime, delegate()
			{
				this.trigger.OnNext(value);
			});
		}

		// Token: 0x06000D10 RID: 3344 RVA: 0x0003F0D0 File Offset: 0x0003D4D0
		public IDisposable Report(T value, DateTimeOffset dueTime)
		{
			return this.scheduler.Schedule(dueTime, delegate()
			{
				this.trigger.OnNext(value);
			});
		}

		// Token: 0x06000D11 RID: 3345 RVA: 0x0003F10B File Offset: 0x0003D50B
		public IDisposable Subscribe(IObserver<T> observer)
		{
			if (observer == null)
			{
				throw new ArgumentNullException("observer");
			}
			return this.trigger.Subscribe(observer);
		}

		// Token: 0x0400075B RID: 1883
		private readonly IScheduler scheduler;

		// Token: 0x0400075C RID: 1884
		private readonly Subject<T> trigger = new Subject<T>();
	}
}
